package com.lebang.feign;

import com.lebang.feign.fallback.BookChapterFallback;
import com.lebang.model.RequestUserInfo;
import com.lebang.model.back.Result;
import com.lebangweb.response.JsonData;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author ljx
 */
@FeignClient(name = "wangzhuan-earns", contextId = "wangzhuan-earns-bookChapter", fallback = BookChapterFallback.class)
public interface BookChapterFeign {
    /**
     * 获取听书时长阶段配置信息
     *
     * @param request
     * @return
     */
    @PostMapping("/app/book/chapterConfig/list")
    JsonData configList(@RequestBody RequestUserInfo request);

    /**
     * 听书章节配置记录添加
     *
     * @param request
     * @param configId
     * @return
     */
    @PostMapping("/app/book/chapterConfig/addDataRecord")
    JsonData bookTimeData(@RequestBody RequestUserInfo request,
                          @ApiParam(name = "配置id") @RequestParam("configId") Integer configId,
                          @ApiParam(name = "听书id") @RequestParam("bookId") String bookId,
                          @ApiParam(name = "章节") @RequestParam("chapter") String chapter);

    /**
     * 获取所有听书累计收益
     *
     * @param request
     * @return
     */
    @PostMapping("/app/book/get/allIncome")
    JsonData bookIncome(@RequestBody RequestUserInfo request);

    /**
     * 领取累计听书金币
     *
     * @param request
     * @param bookId
     * @return
     */
    @PostMapping("/app/book/pull/income")
    Result<Integer> pullIncome(@RequestBody RequestUserInfo request, @ApiParam(name = "听书id") @RequestParam("bookId") String bookId);
}
